package com.yidaozou.dao.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yidaozou.dao.CmsFriendlinkTypeDao;
import com.yidaozou.model.CmsFriendlinkType;
import com.yidaozou.util.PageBean;

@Service
public class CmsFriendlinkTypeDaoImpl implements CmsFriendlinkTypeDao{
	@Autowired
	private SqlSessionFactory sessionFactory;

	public int insertCmsFriendlinkType(CmsFriendlinkType type) {
		int result = sessionFactory.openSession().insert("clark.insertCmsFriendlinkType",type);
		sessionFactory.openSession().commit();
		return result;
	}

	public int updateCmsFriendlinkType(CmsFriendlinkType type) {
		int result = sessionFactory.openSession().update("clark.updateCmsFriendlinkType",type);
		sessionFactory.openSession().commit();
		return result;
	}

	public int deleteCmsFriendlinkType(Integer id) {
		int result = sessionFactory.openSession().delete("clark.deleteCmsFriendlinkType", id);
		sessionFactory.openSession().commit();
		return result;
	}

	public CmsFriendlinkType findCmsFriendlinkTypeById(Integer id) {
		return sessionFactory.openSession().selectOne("clark.selectCmsFriendlinkTypeById", id);
	}

	public List<CmsFriendlinkType> findAllCmsFriendlinkTypes() {
		List<CmsFriendlinkType> gg = sessionFactory.openSession().selectList("clark.selectAllCmsFriendlinkType");
		return gg;
	}

	public List<CmsFriendlinkType> findCmsFriendlinkTypesByPage(Map<String, PageBean> map) {
		List<CmsFriendlinkType> gg = sessionFactory.openSession().selectList("clark.selectCmsFriendlinkTypeByPage", map);
		return gg;
	}

	public List<CmsFriendlinkType> selectTestPage(Map<String, Object> map) {
		List<CmsFriendlinkType> gg = sessionFactory.openSession().selectList("clark.selectTestPage", map);
		return gg;
	}

	public int updateTestCmsFriendlinkType(CmsFriendlinkType type) {
		int result = sessionFactory.openSession().update("clark.updateTestCmsFriendlinkType",type);
		sessionFactory.openSession().commit();
		return result;
	}

	public List<CmsFriendlinkType> selectTestObject(CmsFriendlinkType type) {
		List<CmsFriendlinkType> gg = sessionFactory.openSession().selectList("clark.selectTestObject", type);
		return gg;
	}

	public List<Map> selectTestMap(Map map) {
		List<Map> gg = sessionFactory.openSession().selectList("clark.selectTestMap", map);
		return gg;
	}
	
}
